package leetcode.code1010;

import java.util.HashMap;
import java.util.Map;

import leetcode.helper.H;

public class Solution {
	public int numPairsDivisibleBy60(int[] time) {
		Map<Integer, Integer> map = new HashMap<>();
		int ans = 0;
		for (int t : time) {
			int mod = t % 60;
			int dif = (60 - mod) % 60;
			ans += map.getOrDefault(dif, 0);
			map.put(mod, map.getOrDefault(mod, 0) + 1);
		}
		return ans;
	}
	//[174,188,377,437,54,498,455,239,183,347,59,199,52,488,147,82] 2
	public static void main(String[] args) {
		Solution so = new Solution();
		so.numPairsDivisibleBy60(H.str2array3("[174,188,377,437,54,498,455,239,183,347,59,199,52,488,147,82]"));
	}
}
